﻿@model DistributeTransaction.Models.CardInfo

@{
    ViewBag.Title = "New Card Information";
}

<h2>New Card Information</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>CardInfo</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.HoldName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.HoldName)
            @Html.ValidationMessageFor(model => model.HoldName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CardNumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CardNumber)
            @Html.ValidationMessageFor(model => model.CardNumber)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CardType)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.CardType, new SelectList(Model.CardTypeList))
            @Html.ValidationMessageFor(model => model.CardType)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ExpireMonth)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.ExpireMonth, new SelectList(Model.MonthList))
            @Html.ValidationMessageFor(model => model.ExpireMonth)
        </div>

          <div class="editor-label">
            @Html.LabelFor(model => model.ExpireYear)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.ExpireYear,new SelectList( Model.YearList))
            @Html.ValidationMessageFor(model => model.ExpireYear)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ValidCode)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ValidCode)
            @Html.ValidationMessageFor(model => model.ValidCode)
        </div>

        <p>
            <input type="submit" value="Create" />
            <input type="button" id="btnCancel" value="Cancel" />
        </p>
    </fieldset>
}
<script type="text/javascript">
    $(document).ready(function () {
        $('#btnCancel').click(function () {
            window.location = '@Url.Content("~/Information")';
        });
    });
</script>